package com.houda.cn.utils;

import android.content.Context;
import android.content.SharedPreferences;

import com.houda.cn.contect.ConstantUtils;
import com.houda.cn.mian.CompontApplayCation;


/**
 * 作者: 赵航
 * 创建时间: 2018/8/13 18:30
 * 描述:
 */
public class SaveUtils {
    private static SharedPreferences sharedPreferences;
    /**
     * 保存本地sp电话号码
     */
    public static void setString(String name, String filename) {
        //保存本地电话号码
        sharedPreferences = CompontApplayCation.context.getSharedPreferences(filename, Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPreferences.edit();
        String s = DesSecreat.getInstance().encryptPassword(name);
        editor.putString(ConstantUtils.SAVECONSTANT, s);
        editor.commit();
    }
    public static String getString(String filename) {
        sharedPreferences = CompontApplayCation.context.getSharedPreferences(filename, Context.MODE_PRIVATE);
        String name = sharedPreferences.getString(ConstantUtils.SAVECONSTANT, "");
        String s = DesSecreat.getInstance().decryptPassword(name);
        return s;
    }
}

